package org.smr.ministore.service.impl;

import java.util.List;

import org.blade.dao.base.BaseMapper;
import org.blade.service.base.AbstractService;
import org.blade.utils.IdGenUtils;
import org.blade.utils.Pager;

import org.smr.ministore.dao.RouteMapper;
import org.smr.ministore.entities.Route;
import org.smr.ministore.service.RouteService;

import org.springframework.beans.factory.annotation.Autowired;


import org.springframework.stereotype.Service;

@Service("RouteService")
public class RouteServiceImpl extends AbstractService<String, Route> implements RouteService {

	@Autowired
	private RouteMapper mapper;

	public RouteServiceImpl(RouteMapper mapper) {
		super(mapper);
	}

	public int save(Route entity) {
        super.modifyAttach(entity);
		return mapper.insert(entity);
	}

	public int updateById(Route id) {
		super.modifyAttach(id);
		return mapper.updateById(id);
	}


	public int deleteByIdLogical(Long id) {
		return 0;
	}

	public Route queryById(String id) {
		return mapper.selectById(id);
	}

	public int deleteById(String id) {
		return mapper.deleteById(id);
	}

	public Pager<Route> paginate( Route entity, Long pageSize, Long pageNum) {

		Pager<Route> pager = new Pager( pageSize, pageNum );
		List list  = mapper.pagination(entity, pager);
		pager.setEntities(list);
		return pager;
    }
	
	public int batchSave(List<Route> entities) {
		return mapper.batchInsert(entities);
	}


	public int batchModify(List<Route> entities) {
		return 0;
	}

	public String getId() {
		return IdGenUtils.getGUID();
	}
}
